package org.yelongframework.spring.web.servlet.view;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.View;

/**
 * 字节数组视图
 * 
 * @since 1.0.0
 */
public class ByteArrayView implements View {

	private final byte[] data;

	public ByteArrayView(byte[] data) {
		this.data = data;
	}

	@Override
	public void render(Map<String, ?> model, HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		response.getOutputStream().write(data);
	}

}
